
function $http(url,method="GET",data={}){
    return new Promise((resolve,reject)=>{
        wx.request({
            url: 'https://api2301.h5project.cn/1.1/'+url,
            method,
            header:{
              'X-LC-Id':'JLjLPBuvkDdPOdOtWxo5vrTi-gzGzoHsz',
              'X-LC-Key':'aBO9cNU8LlXNV7T06Wk6egM4',
              "content-type":"application/json"
            },
            data,
            success:(res)=>{
                resolve(res) //将数据给到then
            },
            fail:(err)=>{
                reject(err) //将错误信息给到catch
            }
        })
    })
}

// $http.then()

function $get(url,data={}){
    return $http(url,'GET',data)
}

export {
    $http,
    $get
}